<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>JSX小练习</title>
  </head>
  <body>
    <div id="container"></div>
    <script type="text/javascript" src="../js/react.development.js"></script>
    <script
      type="text/javascript"
      src="../js/react-dom.development.js"
    ></script>
    <script type="text/javascript" src="../js/babel.min.js"></script>

    <script type="text/babel">
      // 2. 动态数据
      const obj = {
        title: "前端JS框架列表",
        list: ["Angular", "React", "Vue"],
      };
      // 1. 创建虚拟dom
      const VDOM = (
        <div>
          <h1>{obj.title}</h1>
          <ul>
            {obj.list.map((item,i) => {
              return <li key={i}> {item} </li>;
            })}
          </ul>
        </div>
      );
      /* 
      <li>{obj.list[0]}</li>
      <li>{obj.list[1]}</li>
      <li>{obj.list[2]}</li>
      */
      // 3. DOM渲染
      ReactDOM.render(VDOM, document.getElementById("container"));
    </script>
  </body>
</html>
